package com.ihr360.oneclick.service;

import com.ihr360.oneclick.dto.spreadsheet.SpreadsheetRowDto;
import com.ihr360.oneclick.entity.RowHeaderColumn;
import com.ihr360.oneclick.entity.Spreadsheet;
import com.ihr360.oneclick.request.SearchRequest;
import com.ihr360.oneclick.request.SpreadsheetDetailRequest;
import com.ihr360.oneclick.request.SpreadsheetFootColumnRequest;
import com.ihr360.oneclick.request.SpreadsheetPublishRequest;
import com.ihr360.oneclick.vo.PageData;
import com.ihr360.oneclick.vo.SpreadsheetDetailVo;
import com.ihr360.oneclick.vo.SpreadsheetVo;

import java.util.List;

/**
 * 电子表格业务类
 *
 * @author tom
 * @date 17-12-18
 */
public interface SpreadsheetService {

    /**
     * 根据公司Id获取Spreadsheet 分页数据
     *
     * @param companyId     公司Id
     * @param userId        用户Id
     * @param searchRequest 查询参数
     * @return page data
     */
    PageData<Spreadsheet> getPageDataByCompanyId(String companyId, String userId, SearchRequest searchRequest);

    /**
     * 根据Id获取电子表格
     * notes: 电子表格导出可调用
     *
     * @param spreadsheetId SpreadsheetDto.id
     * @return Spreadsheet
     */
    Spreadsheet getSpreadsheetById(String spreadsheetId);

    /**
     * 通过Id获取电子表格详情
     * notes: 包含row分页信息
     *
     * @param spreadsheetDetailRequest Request
     * @return SpreadsheetDetailVo
     */
    SpreadsheetDetailVo getSpreadsheetDetail(SpreadsheetDetailRequest spreadsheetDetailRequest);

    SpreadsheetDetailVo getSpreadsheetTempDetail(SpreadsheetDetailRequest spreadsheetDetailRequest);

    List<SpreadsheetRowDto> prePublishSpreadsheet(String companyId, String spreadsheetId);

    /**
     * 发布
     * notes: 状态为不允许发布的row排除
     *
     * @param spreadsheetPublishRequest SpreadsheetPublishRequest
     */
    void publishSpreadsheet(String companyId, String userId, SpreadsheetPublishRequest spreadsheetPublishRequest);

    /**
     * 发布行数据
     * @param companyId
     * @param spreadsheetPublishRequest
     */
    void publishSpreadSheetRow(String companyId, SpreadsheetPublishRequest spreadsheetPublishRequest);

    /**
     * 保存电子表格
     * notes: 导入电子表格可调用，如果导入表头与第一次有出入不允许导入
     *
     * @param spreadsheet 保存的电子表格内容
     */
    void saveSpreadsheet(SpreadsheetVo spreadsheet);

    /**
     * 删除电子表格
     *
     * @param spreadsheetId SpreadsheetDto.id
     */
    void deleteSpreadsheet(String spreadsheetId);

    /**
     * 批量删除电子表格
     *
     * @param spreadsheetIdList SpreadsheetDto.id list
     */
    void deleteSpreadsheetBatch(List<String> spreadsheetIdList);

    /**
     * 获取电子表格自定义表头数据
     */
    List<RowHeaderColumn> getRowHeader(String spreadsheetId);

    /**
     * 获取电子表格自定义表头数据
     */
    List<RowHeaderColumn> getFootHeader(String spreadsheetId);

    /**
     * 保存用户设置合计列
     */
    void saveFootColumn(SpreadsheetFootColumnRequest request);

    /**
     * 保存合计数据
     */
    void saveFootData(String spreadsheetId);

    void withdrawRowPublish(List<String> spreadSheetRowId, String spreadsheetId);

    /**
     * 群发工资条
     * @param companyId
     * @param spreadsheetPublishRequest
     */
    void oneclickPublishSpreadSheet(String companyId, SpreadsheetPublishRequest spreadsheetPublishRequest);
}
